//
//  IndexBarCell.swift
//  Game
//
//  Created by woniu on 2025/9/12.
//

import Foundation
import UIKit
import SnapKit

class IndexBarCell: UITableViewCell {
    static let reuseIdentifier = "IndexBarCell"

    public let titleLabel = UILabel()
    private let resultImageView = UIImageView()

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setup()
    }
    required init?(coder: NSCoder) { super.init(coder: coder); setup() }

    private func setup(){
        selectionStyle = .none
        backgroundColor = .clear

        titleLabel.font = UIFont.boldSystemFont(ofSize: 20)
        titleLabel.textColor = .white
        titleLabel.numberOfLines = 0
        titleLabel.textAlignment = .center
        titleLabel.circular(20)
        titleLabel.borderSet(.white, 1)
        contentView.addSubview(titleLabel)

        resultImageView.contentMode = .scaleAspectFit
        resultImageView.isHidden = true
        contentView.addSubview(resultImageView)


        resultImageView.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.size.equalTo(CGSize(width: 24, height: 24))
        }

        titleLabel.snp.makeConstraints { make in
            make.size.equalTo(CGSize(width: 40, height: 40))
            make.center.equalToSuperview()
        }
    }

}
